<?php
  if ($posts){
    echo '<table class="fw fb">';
    foreach ($posts as $row){
      echo '<tr id="p'.$row['post_id'].'" class="post">';
      echo '<td class="postbody">';
      if ($row['title']){
        echo '<h3>'.anchor(current_url().'#p'.$row['post_id'], $row['title']).'</h3>';
      } else {
        echo '<h3>'.anchor(current_url().'#p'.$row['post_id'], lang('Reply').'# '.$row['post_id']).'</h3>';
      }
      echo '<p>'.date('d.m.Y H:i', $row['created']).'</p>';
      echo $row['body_r'];
      echo '</td>';
      echo '<td class="postprofile">';
      echo '<dl id="profile'.$row['user_id'].'">';
      echo '  <dt><img src="'.gravatar($row['email']).' alt="'.$row['username'],'" /></dt>';
      echo '  <dt>'.anchor('user/profile/'.$row['user_id'], $row['username']).'</dt>';
      echo '</dl>';
      echo '</td>';
      echo '</tr>';
    }
    echo '</table>';
    echo $this->pagination->create_links();
    $this->load->view('partials/post_tpl');
  } else {
    echo '<p class="notice">'.lnag('No topics found').'</p>';
  }
?>
